{include file="$header"}
<div id="app" v-cloak>
    <el-curd 
        :field="field" 
        :search-date="false" 
        :table-operation-width="250"
        :table-sort="{prop: 'create_time', order: 'desc'}"
        :search-status="[{label: '正常', value: 1}, {label: '屏蔽', value: 0}]"
        variable="userInfo"
        preview>
        <template v-slot:operation="{self, row}">
            <el-tooltip content="查看日志" placement="top">
                <el-button icon="el-icon-reading" size="mini" circle @click="id = row.id;logDrawer = true;"></el-button>
            </el-tooltip>
        </template>
    </el-curd>
    <el-drawer :visible.sync="logDrawer" :with-header="false" size="100%">
        <el-page-header @back="logDrawer=false" content="日志列表">
            <template v-slot:title>Esc键返回</template>
        </el-page-header>
        <iframe class="el-drawer-iframe" :src="url('userLog/index', {id: id})"></iframe>
    </el-drawer>
</div>
<script>
    new Vue({
        el: '#app',
        data() {
            return {
                id: '',
                logDrawer: false,
                field: [
                    {
                        label: '编号', 
                        prop: 'id',
                        table: false,
                    },
                    {
                        prop: 'cover', 
                        label: '头像', 
                        table: {label: '资料', is: 'image',width: '70px'},
                        form: {is: 'el-file-select',type: 'image'},
                    },
                    {
                        prop: 'email', 
                        label: '邮箱', 
                        table: {label: '', bind: ['mobile'], width: '250px'},
                        form: {
                            rules: [
                                {required: true, message: '邮箱不能为空'},
                            ],
                            colMd: 12
                        },
                    },
                    {
                        prop: 'mobile', 
                        label: '手机', 
                        table: false,
                        form: {colMd: 12}
                    },
                    {
                        prop: 'nickname', 
                        label: '昵称', 
                        table: false,
                        form: {
                            rules: [
                                {required: true, message: '昵称不能为空'},
                            ],
                            colMd: 12
                        },
                    },
                    {
                        prop: 'login_count', 
                        label: '登录次数', 
                        table:{sort: true},
                        form: false,
                    },
                    {
                        prop: 'group_id', 
                        label: '所属组别',
                        table: {prop: 'group_title', sort: true},
                        form: {
                            is: 'el-select', 
                            child: {is: 'el-option',value: {:json_encode($group)}, props:{label: 'title', value: 'id'}},
                            rules: [
                                {required: true, message: '请选择组别'},
                            ],
                            colMd: 12
                        },
                    },
                    {
                        prop: 'password', 
                        label: '密码', 
                        table: false, 
                        form: {
                            type: 'password',
                            placeholder: '不修改密码则此处为空',
                            rules: [
                                {saveRequired: true, message: '新增用户时，密码不能为空'},
                                {pattern: /^[^\u4e00-\u9fa5]+$/, message: '不能包含中文字符'}
                            ],
                            colMd: 12
                        },
                    },
                    {
                        prop: 'sex', 
                        label: '性别', 
                        table: false,
                        form: {
                            is: 'el-select',
                            default: 0, 
                            child: {is: 'el-option', value:[{label:'男', value:0},{label:'女',value:1}]},
                            colMd: 12
                        }
                    },
                    {
                        prop: 'balance', 
                        label: '余额',  
                        table:{sort: true},
                        form: {type: 'number',default: 0.00,colMd: 8}
                    },
                    {
                        prop: 'now_integral', 
                        label: '积分',  
                        table:{sort: true},
                        form: {type: 'number',default: 0,colMd: 8}
                    },
                    {
                        prop: 'birthday', 
                        label: '生日',
                        table: false,
                        form: {is: 'el-date-picker', type: 'date', format: 'yyyy-MM-dd', valueFormat: 'yyyy-MM-dd',colMd: 8},
                    },
                    {
                        prop: 'describe', 
                        label: '签名', 
                        table: false,
                        form: {type: 'textarea'},
                    },
                    {
                        prop: 'status',
                        label: '状态',  
                        table: {sort: true, prop: 'c_status'}, 
                        form: {is: 'el-switch', default: 1},
                    },
                    {
                        prop: 'create_time', 
                        label: '注册时间', 
                        table:{label: '注册&登录时间',sort: true, bind: ['login_time'], width: '160px'},
                        form: false,
                    },
                ],
            }
        },
    })
</script>
{include file="$footer"}